 <script>
 $(document).ready(function(){
	$("#checkHtml").click(function(){
		$("#htmlView").html($("#htmlEditor textarea").val());
	});
	
	$('#htmlEditor textarea').on('keyup',function(e) {
		while($(this).outerHeight() < this.scrollHeight + parseFloat($(this).css("borderTopWidth")) + parseFloat($(this).css("borderBottomWidth"))) {
			$(this).height($(this).height()+1);
		};
	});
	
	$("select#advertiseOptionCountry").append("<option>Select Country</option>");
	$.ajax({
		url:"admajxsrvlt",
		data:{
			methodToCall:"getAllCountries"
		},
		type:"POST",
		success:function(data){
			var result=JSON.parse(data);
			var countryArray = result.countryList.replace("[","").replace("]","").split(",");
			var countryName;
			for(countryName in countryArray){
				$("select#advertiseOptionCountry").append("<option value='"+countryArray[countryName]+"'>"+countryArray[countryName]+"</option>");
			}
			
		},
		error:function(){
			
		}
	});
	
	$("select#advertiseOptionCountry").change(function(){
		$("select#advertiseOptionCity").parents(".col-lg-4	").addClass("hide");
		var countrySelected = $(this).val();
		$("select#advertiseOptionState").html("");
		$("select#advertiseOptionState").append("<option>Select State</option>");
		$.ajax({
		url:"admajxsrvlt",
		data:{
			methodToCall:"getStateInCountries",
			country:countrySelected
		},
		type:"POST",
		success:function(data){
			$("select#advertiseOptionState").parents(".col-lg-4").removeClass("hide");
			var result=JSON.parse(data);
			var stateArray = result.stateList.replace("[","").replace("]","").split(",");
			var stateName;
			for(stateName in stateArray){
				$("select#advertiseOptionState").append("<option value='"+stateArray[stateName]+"'>"+stateArray[stateName]+"</option>");
			}
			
		},
		error:function(){
			
		}
	});
	});
	
	$("select#advertiseOptionState").change(function(){
		var countrySelected = $("select#advertiseOptionCountry").val();
		var stateSelected = $(this).val();
		$("select#advertiseOptionCity").html("");
		$("select#advertiseOptionCity").append("<option>Select City</option>");
		$.ajax({
		url:"admajxsrvlt",
		data:{
			methodToCall:"getCityInStateAndCountries",
			country:countrySelected,
			state:stateSelected
		},
		type:"POST",
		success:function(data){
			$("select#advertiseOptionCity").parents(".col-lg-4").removeClass("hide");
			var result=JSON.parse(data);
			var cityArray = result.cityList.replace("[","").replace("]","").split(",");
			var cityName;
			for(cityName in cityArray){
				$("select#advertiseOptionCity").append("<option value='"+cityArray[cityName]+"'>"+cityArray[cityName]+"</option>");
			}
			
		},
		error:function(){
			
		}
	});
	});
	
	$("input.globalAddCheckbox").change(function(){
		if("yes"==$(this).val()){
			$("select#advertiseOptionCountry,select#advertiseOptionState,select#advertiseOptionCity").parents(".row").addClass("hide");
		}else{
			$("select#advertiseOptionCountry,select#advertiseOptionState,select#advertiseOptionCity").parents(".row").removeClass("hide");
		}
	});
 });
 
 </script>
<div class="alert alert-success">
		Added Libraries &nbsp; Bootstrap.css version v3.0.2, &nbsp; Jquery v1.10.2, &nbsp;  JavaScript Supported
	</div>
	<form>
	<div class="row">
		Is Homepage Advertise <br>
		<input type="radio" class="globalAddCheckbox" name="globaladd" value="yes"/>Yes
		<input type="radio" class="globalAddCheckbox" name="globaladd" value="no" checked="checked"/>No
	</div>
	<div class="row" >
	<div class="col-lg-4">
	<label for="advertiseOptionCountry">Country</label>
	<select id="advertiseOptionCountry" class="btn btn-default"></select>
	</div>
	
	<div class="col-lg-4 hide">
	<label for="advertiseOptionState">State</label>
	<select id="advertiseOptionState"  class="btn btn-default"></select>
	</div>
	
	<div class="col-lg-4 hide">
	<label for="advertiseOptionCity">City</label>
	<select id="advertiseOptionCity"  class="btn btn-default"></select>
	</div>
	</div>
	<div class="form-group">
	<label for="htmlEditor">Insert Add Here in HTML</label>
	<div id="htmlEditor">
		<textarea class="form-control"></textarea>
	</div>
	</div>
	<div class="form-group">
		<a class="btn btn-default" id="checkHtml">Check</a>
	</div>	
	
	<div class="form-group">
	<label for="htmlView">View HTML Result</label>
	<div id="htmlView"></div>
	</div>
	</form>
